import Vue from 'vue'
import Router from 'vue-router'
// import store from '@/store'         // api: https://github.com/vuejs/vuex
// import API from '@/api'
// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有开发环境使用懒加载
const _import = require('./import-' + process.env.NODE_ENV)
Vue.use(Router)

// 路由定义使用说明:
// 1. 代码中路由统一使用name属性跳转.
// 2. 开放path属性用做简短路由, 比如: '/a1', 访问地址: www.renren.io/#/a1

const router = new Router({
  mode: 'hash',
 // base: 'vote',
  routes: [
    { path: '/404', component: _import('error/404'), name: '404', desc: '404未找到' },
    { path: '/login', component: _import('login/index'), name: 'login', desc: '登录', meta: { title: '管理员登陆' } },
    { path: '/m/login', component: _import('basemember/login'), name: 'm-login', desc: '会员登录', meta: { title: '会员登陆' } },
    { path: '/m/reg', component: _import('basemember/reg'), name: 'm-reg', desc: '会员注册', meta: { title: '会员注册' } },
    {
      path: '/',
      component: _import('layout/index'),
      name: 'layout',
      redirect: { name: 'home' },
      desc: '上左右整体布局',
      children: [
        { path: '/home', component: _import('home/index'), name: 'home', desc: '主页' },
        {
          path: '/content-tabs',
          component: _import('layout/content-tabs'),
          name: 'content-tabs',
          redirect: { name: '404' },
          desc: '内容需通过tabs展示',
          children: [
            // 以'/n'开头统一拦截, 标记为左侧菜单导航tab展示内容方式路由
            { path: '/n/user', component: _import('user/index'), name: 'user', desc: '管理员管理', meta: { title: '管理员登陆' } },
            { path: '/n/role', component: _import('role/index'), name: 'role', desc: '角色管理', meta: { title: '角色管理' } },
            { path: '/n/menu', component: _import('menu/index'), name: 'menu', desc: '菜单管理', meta: { title: '菜单管理' } },
            { path: '/n/sql', component: _import('sql/index'), name: 'sql', desc: 'SQL监控', meta: { title: 'SQL监控' } },
            { path: '/n/schedule', component: _import('schedule/index'), name: 'schedule', desc: '定时任务', meta: { title: '定时任务' } },
            { path: '/n/config', component: _import('config/index'), name: 'config', desc: '参数管理', meta: { title: '参数管理' } },
            { path: '/n/oss', component: _import('oss/index'), name: 'oss', desc: '文件上传', meta: { title: '文件上传' } },
            { path: '/n/log', component: _import('log/index'), name: 'log', desc: '系统日志', meta: { title: '系统日志' } },
            { path: '/n/web', component: _import('basewebinfo/index'), name: 'basewebinfo', desc: '网站设置', meta: { title: '网站设置' } },
            { path: '/n/basemember', component: _import('basemember/index'), name: 'basemember', desc: '会员管理', meta: { title: '会员管理' } },
            { path: '/n/basememberapply', component: _import('basememberapply/index'), name: 'basememberapply', desc: '代理审核', meta: { title: '代理审核' } },
            { path: '/n/basememberapply-member', component: _import('basememberapply/apply'), name: 'basememberapply-member', desc: '广告设置', meta: { title: '广告设置' } },
            { path: '/n/yqcode', component: _import('baseyqcode/index'), name: 'baseyqcode', desc: '邀请码管理', meta: { title: '邀请码管理' } },
            { path: '/n/baseadv', component: _import('baseadv/index'), name: 'baseadv', desc: '广告位管理', meta: { title: '广告位管理' } },
            { path: '/n/baseadvvideo', component: _import('baseadvvideo/index'), name: 'baseadvvideo', desc: '视频管理', meta: { title: '视频管理' } },
            { path: '/n/basework', component: _import('basework/index'), name: 'basework', desc: '参赛', meta: { title: '视频管理' } },
            { path: '/n/baseworknews', component: _import('baseworknews/index'), name: 'baseworknews', desc: '参赛作品新闻', meta: { title: '参赛作品新闻' } },
            { path: '/n/baseworkvote', component: _import('baseworkvote/index'), name: 'baseworkvote', desc: '参赛作品列表', meta: { title: '参赛作品列表' } },
            { path: '/n/baseworkvoteip', component: _import('baseworkvoteip/index'), name: 'baseworkvoteip', desc: '投票ip列表', meta: { title: '投票ip列表' } },
            { path: '/n/basedomain', component: _import('basedomain/index'), name: 'basedomain', desc: '落地域名管理', meta: { title: '落地域名管理' } },
            { path: '/n/basesite', component: _import('basesite/index'), name: 'basesite', desc: '站点管理', meta: { title: '站点管理' } },
            { path: '/n/basesiteone/:id', component: _import('basesite/basesiteone'), name: 'basesiteone', desc: '站点管理', meta: { title: '站点管理' } },
            { path: '/n/addsiteadvvideo', component: _import('basesiteadvvideo/addsiteadvvideo'), name: 'addsiteadvvideo', desc: '添加视频', meta: { title: '添加视频' } },
            { path: '/n/randomsiteadvvideo', component: _import('basesiteadvvideo/randomsiteadvvideo'), name: 'randomsiteadvvideo', desc: '随机视频', meta: { title: '随机视频' } },
            { path: '/n/basesiteadvvideo', component: _import('basesiteadvvideo/index'), name: 'basesiteadvvideo', desc: '推广管理', meta: { title: '推广管理' } }
          ]
        }
      ]
    },
    { path: '*', redirect: { name: '404' } }
  ]
})
export default router
